namespace TimeSheet.Protected.View.Model
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		Summary description for EditClient.
	/// </summary>
	public abstract class EditClient : EntityControl
	{
		protected System.Web.UI.WebControls.Label lblAddEditTitle;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.CheckBox Active;
		protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
		protected System.Web.UI.WebControls.Button btnSave;
		protected System.Web.UI.WebControls.TextBox Name;
		protected System.Web.UI.WebControls.TextBox Contact;
		protected System.Web.UI.WebControls.TextBox Email;
		protected System.Web.UI.WebControls.TextBox Phone;
		protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
		protected eWorld.UI.CollapsablePanel cpEntity;

		private void Page_Load(object sender, System.EventArgs e)
		{
			this.BindControlToEntity();
			if( this.BoundEntity.ID > 0 )
			{
				this.btnSave.Text = "Update";
				this.lblAddEditTitle.Text = "Edit Client";
			}
			else
			{
				this.btnSave.Text = "Create";
				this.lblAddEditTitle.Text = "Add Client";
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			this.LoadEntityFromForm();
			this.SaveBoundEntity();
			Response.Redirect( "~/Protected/Client.aspx" );
		}
	}
}
